use std::iter::Rev;

fn main() {
    let num:u32 = 9;
    if num < 5 {
        println!("小于");
    }else{
        println!("大于");
    }

    //if 是一个表达式!!!!!!
    //可以将if表达式放到等号的右边
    let condition = false;
    let number = if condition {
        5
    }else{
        6
    };

    println!("number的值是:{}",number);

    //控制流
    //loop while for

    //loop
    let mut counter = 0;

    let result = loop {
        counter +=1;

        if counter == 10 {
            break counter*2
        }
    };

    println!("result 的结果是{}",result);


    //while
    let mut num_w = 3;

    while num_w != 0 {
        println!("num is :{}",num_w);
        num_w -=1;
    }
    println!("over");

    //for

    let a = [10,20,30,40,50];

    for ele in a.iter()  {
        println!("the value is :{}",ele);
    }

    //range表示一个范围如下1..5表示从1到4,注意这个只能从大到小,然后再.rev翻转
    for i in (1..5).rev(){
        println!("iiiiiii:{}",i);
    }
    println!("liftoff");

    let yy = 4..2;
    for y in yy {
        
    println!("yy:{}",y);
    }
}
